﻿using Microsoft.EntityFrameworkCore;
using S.Authorization.Domain.SqlServer;

namespace S.Authorization.Read.API.Extensions.Strategy
{
    public class DatabasePolicyProvider : IAuthorizationRoleProvider
    {
        private readonly SqlDbContext db;

        public DatabasePolicyProvider(SqlDbContext _db)
        {
            db = _db;
        }
        public async Task<IEnumerable<string>> GetRolesAsync()
        {
            var roles = await db.RoleModel.Select(r => r.RoleName).ToListAsync();
            return roles;
        }
    }
}
